home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5333 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  48 lines

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: GNU Interrupts
  5. Date: 9 Feb 1996 21:57:15 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4fhc3rINN9km@keats.ugrad.cs.ubc.ca>
  8. References: <schumaker.88.002FB3CD@tigger.jvnc.net> <4f7092$rt1@news.cencom.net>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4f7092$rt1@news.cencom.net>, Bill Wendling <tanp@ns> wrote:
  12.  >Schumaker inexplicably wrote:
  13.  
  14.  >} available?, does linux allow you to call interrupts?, is there one included 
  15.  >} which I haven't found?
  16.  >
  17.  >} any info would be greatly appreciated.
  18.  >
  19.  >Linux doesn't use interrupts.  That is an MS-DOG invention.  
  20.  
  21. Hahaha. All Linux system calls are accessed via interrupts. There is no other
  22. way to pass control to the OS (other than causing an exception).  It's a good
  23. thing too---a lot cleaner than call gates.
  24.  
  25.  
  26. .file    "hello.S"
  27.  
  28. /*
  29.  * compile with gcc -nostdlib -N -s hello.S
  30.  */
  31.  
  32. #include <sys/syscall.h>
  33.  
  34. .text
  35.  
  36. start:    movl    $SYS_write, %eax    /* write() system call code    */
  37.     movl    $1, %ebx        /* stdout one file descriptor    */
  38.     movl    $hello, %ecx        /* pointer to string        */
  39.     movl    $helloe-hello, %edx    /* lenth of string        */
  40.     int    $0x80            /* call Linux!            */
  41.     movl    $SYS_exit, %eax        /* _exit() system call        */
  42.     int    $0x80
  43.  
  44. hello:    .ascii    "Hello, World!\n"
  45. helloe:
  46. -- 
  47.  
  48.